package main

import (
	"blockchain_tool/platform"
	"blockchain_tool/platform/bitget"
	"blockchain_tool/platform/coinw"
	"blockchain_tool/platform/xt"
	"fmt"
	"os"
)

func getPlatForm(platform string) platform.Platform {
	switch platform {
	case "XT":
		return &xt.XT{}
	case "BITGET":
		return &bitget.BITGET{}
	case "COINW":
		return &coinw.COINW{}

	default:
		return nil
	}
}

func main() {
	if len(os.Args) < 2 {
		fmt.Println("请指定平台名称: XT、BITGET 或 COINW")
		return
	}

	platform := os.Args[1]
	pl := getPlatForm(platform)
	if pl == nil {
		fmt.Println("未知的平台:", platform)
		return
	}

	fmt.Printf("开始执行任务: %s\n", pl.Name())
	if err := pl.Run(); err != nil {
		fmt.Println("任务执行失败:", err)
	} else {
		fmt.Println("任务执行完成。")
	}
}
